#ifndef __CLASS_HTTP_MANGER_H__
#define __CLASS_HTTP_MANGER_H__

#include <Arduino.h>
#include <DNSServer.h>
#include <ESPAsyncWebServer.h>
#include <ESPAsyncHTTPUpdateServer.h>

class HttpManger
{
private:
    AsyncWebServer _httpServer;
    DNSServer _dns;
    ESPAsyncHTTPUpdateServer _httpUpdater;

public:
    HttpManger(int port = 80);
    ~HttpManger();

    void begin();
    void handle();

    AsyncWebServer* webServer();
    DNSServer* dns();
protected:
    void handleWeb(AsyncWebServerRequest *request);
    void handleWebSet(AsyncWebServerRequest *request);
    void handleNotFound(AsyncWebServerRequest *request);
};

extern HttpManger httpManger;

#endif //!__CLASS_HTTP_MANGER_H__